package com.konsung.greendaoUtil;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.konsung.bean.ConfigDto;
import com.konsung.bean.MeasureDataBean;
import com.konsung.bean.PatientBean;

import com.konsung.greendaoUtil.ConfigDtoDao;
import com.konsung.greendaoUtil.MeasureDataBeanDao;
import com.konsung.greendaoUtil.PatientBeanDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig configDtoDaoConfig;
    private final DaoConfig measureDataBeanDaoConfig;
    private final DaoConfig patientBeanDaoConfig;

    private final ConfigDtoDao configDtoDao;
    private final MeasureDataBeanDao measureDataBeanDao;
    private final PatientBeanDao patientBeanDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        configDtoDaoConfig = daoConfigMap.get(ConfigDtoDao.class).clone();
        configDtoDaoConfig.initIdentityScope(type);

        measureDataBeanDaoConfig = daoConfigMap.get(MeasureDataBeanDao.class).clone();
        measureDataBeanDaoConfig.initIdentityScope(type);

        patientBeanDaoConfig = daoConfigMap.get(PatientBeanDao.class).clone();
        patientBeanDaoConfig.initIdentityScope(type);

        configDtoDao = new ConfigDtoDao(configDtoDaoConfig, this);
        measureDataBeanDao = new MeasureDataBeanDao(measureDataBeanDaoConfig, this);
        patientBeanDao = new PatientBeanDao(patientBeanDaoConfig, this);

        registerDao(ConfigDto.class, configDtoDao);
        registerDao(MeasureDataBean.class, measureDataBeanDao);
        registerDao(PatientBean.class, patientBeanDao);
    }
    
    public void clear() {
        configDtoDaoConfig.clearIdentityScope();
        measureDataBeanDaoConfig.clearIdentityScope();
        patientBeanDaoConfig.clearIdentityScope();
    }

    public ConfigDtoDao getConfigDtoDao() {
        return configDtoDao;
    }

    public MeasureDataBeanDao getMeasureDataBeanDao() {
        return measureDataBeanDao;
    }

    public PatientBeanDao getPatientBeanDao() {
        return patientBeanDao;
    }

}
